wayland/glcontext: Fix damage region on HiDPI
authorJonas Ådahl <jadahl@gmail.com>
Tue, 3 Dec 2019 15:32:59 +0000 (16:32 +0100)
committerJonas Ådahl <jadahl@gmail.com>
Tue, 3 Dec 2019 15:45:37 +0000 (16:45 +0100)
The passed regions are in surface coordinates, but
eglSwapBuffersWithDamage() is in buffer coordinates.

gdk/wayland/gdkglcontext-wayland.c

index 40df428a384a8be823e25ffc0efc69900f9262b1..c6b2116b26bfa97d932170785df95c1a0ca96f60 100644 (file)
@@ -244,14 +244,15 @@ gdk_wayland_gl_context_end_frame (GdkDrawContext *draw_context,
       EGLint *rects = g_new (EGLint, n_rects * 4);
       cairo_rectangle_int_t rect;
       int surface_height = gdk_surface_get_height (surface);
+      int scale = gdk_surface_get_scale_factor (surface);
 
       for (i = 0, j = 0; i < n_rects; i++)
         {
           cairo_region_get_rectangle (painted, i, &rect);
-          rects[j++] = rect.x;
-          rects[j++] = surface_height - rect.height - rect.y;
-          rects[j++] = rect.width;
-          rects[j++] = rect.height;
+          rects[j++] = rect.x * scale;
+          rects[j++] = (surface_height - rect.height - rect.y) * scale;
+          rects[j++] = rect.width * scale;
+          rects[j++] = rect.height * scale;
         }
       eglSwapBuffersWithDamageEXT (display_wayland->egl_display, egl_surface, rects, n_rects);
       g_free (rects);